<template>
  <van-swipe-cell>
    <div @click="handleGo(item.id)" v-for="item in list">
      <van-card :desc="item.description" :title="item.name" :price="item.sex == 1 ? '男' : '女'" class="goods-card"
        :thumb="item.photo" />
    </div>
    <template #right>
      <van-button square text="删除" type="danger" class="delete-button" />
    </template>
  </van-swipe-cell>
</template>

<script>
import { SwipeCell } from 'vant';
import { ref,createApp,onMounted } from 'vue';
import axios from 'axios'
import Cookie from 'js-cookie'
import { useRouter, useRoute } from 'vue-router'

export default {
  setup() {
    const item = ref(null);
    const value = ref(0);
    const list = ref([]);
    const router = useRouter()
    const onClickLeft = () => history.back()

    const handleGo = (id) => {
      router.push({ name: 'detail', query: { id, type: 'clue' } })
    }

    onMounted(() => {
      axios.get('/mock/relative').then(res => {
        if (res.data.code == 200) {
          list.value = res.data.data
          list.value = [...list.value, JSON.parse(Cookie.get('relativeList'))]
        }
      })
    })
    return {
      item,
      handleGo,
      value,
      list,
      onClickLeft
    };
  },
};


// const app = createApp();
// app.use(SwipeCell);


</script>

<style>
  .goods-card {
    margin: 0;
    background-color: @white;
  }

  .delete-button {
    height: 100%;
  }
</style>

